#include <iostream>
using namespace std;
 
int main(){
  int i = 0, j = 0;
  bool x = false;
  cin >> i;
  j = i - 1;
  while ( j > 0 )
  {
    x = ((bool) ( j % 2 ) ) ^ x;
    j = j / 2;
  };
  cout << x << endl;
  return 0;
}